<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      div {
        overflow: scroll;
        width: 200px;
        height: 100px;
        border: 1px solid black;
      }
      ul{
        list-style-type: none;
        margin: 0;
        padding: 0;
      }
    </style>
  </head>
  <body>
    <div id="div">
      <ul id="ul">
        <li>保留所有权利1</li>
        <li>保留所有权利2</li>
        <li>保留所有权利3</li>
        <li>保留所有权利4</li>
        <li>保留所有权利5</li>
        <li>保留所有权利6</li>
        <li>保留所有权利7</li>
        <li>保留所有权利8</li>
      </ul>
    </div>

    <script>
      console.log(div.scrollHeight)
      div.onscroll=()=>{
        console.log(div.scrollTop);
      }
    </script>
  </body>
</html>
